package com.example.myapplication;

import android.content.Context;
import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class BlankFragment4 extends Fragment {
    RecyclerView recyclerView;

    Context context;

    Adapter4 adapter;
    ImageView imageView1,imageView2;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.activity_adapter4, container, false);

        recyclerView= view.findViewById(R.id.recycler4);

        imageView1= view.findViewById(R.id.imageView_my);

        imageView2= view.findViewById(R.id.imageView_quit);

        imageView1.setImageResource(R.drawable.my);

        imageView2.setImageResource(R.drawable.arrow);

        List<Map<String,Object>> list=new ArrayList<>();

        int[] img={R.drawable.my_pay,R.drawable.my_fav,R.drawable.my_wall,R.drawable.my_options};

        String[] name={"服务","收藏","卡包","设置"};

        for(int i=0;i<img.length;i++){
            Map<String,Object> map=new HashMap<>();
            map.put("image",img[i]);
            map.put("name",name[i]);
            map.put("arrow",R.drawable.arrow);
            list.add(map);
        }

        context=getContext();

        adapter=new Adapter4(getContext(),list);

        LinearLayoutManager manager=new LinearLayoutManager(getContext());

        manager.setOrientation(RecyclerView.VERTICAL);

        recyclerView.setAdapter(adapter);

        recyclerView.setLayoutManager(manager);
        return view;
    }
}